package com.zhq.blog.core.domain.product;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.Transient;
import com.zhq.blog.core.domain.BasePersistentDomain;

@Entity
public class Category extends BasePersistentDomain<CategoryRepository> {
	
	private String name;    //分类名称
	private long sort;		//分类排序
	private long flag;		//0是一级分类 1是二级分类
	private long categoryId;  //父类ID
	private String cateName;
	
    @Transient
    protected List<Category> categoryList;
    
    @Transient
    private Category category;
	
	public List<Category> getCategoryList() {
		return categoryList;
	}

	public void setCategoryList(List<Category> categoryList) {
		this.categoryList = categoryList;
	}
	

	public Category(){}
	
	public Category(String name, long sort, long flag,long categoryId) {
		super();
		this.name = name;
		this.sort = sort;
		this.flag = flag;
		this.categoryId = categoryId;
	}
	public Category(String name, long sort, long flag) {
		super();
		this.name = name;
		this.sort = sort;
		this.flag = flag;
	}
	
	public String getCateName() {
		return cateName;
	}

	public void setCateName(String cateName) {
		this.cateName = cateName;
	}

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public long getSort() {
		return sort;
	}
	public void setSort(long sort) {
		this.sort = sort;
	}
	public long getFlag() {
		return flag;
	}
	public void setFlag(long flag) {
		this.flag = flag;
	}
	
	public long getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(long categoryId) {
		this.categoryId = categoryId;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	public void init() {
		category =context.getCategoryRepository().findOne(categoryId);
	}
	
	
}
